package com.yingdong.db;

import com.yingdong.annotation.PrimeKey;
import com.yingdong.annotation.AutoIncrease;
import java.util.ArrayList;
import java.util.List;

public class Resource extends DBObject{
    
    private static List<Resource> delList=new ArrayList<>();
   
	private static Resource instance;

    /**
	 * 
	 */
	@PrimeKey
	
    private Integer userId;
    
    /**
	 * 
	 */
	@PrimeKey
	
    private Integer itemId;
    
    /**
	 * 
	 */
	
	
    private Integer resourceNum;
    
 

    public Integer getUserId() {
	    return userId;
	}
	
	public void setUserId(Integer userId) {
		this.userId = userId;
		changeDBStatus();
	}

    public Integer getItemId() {
	    return itemId;
	}
	
	public void setItemId(Integer itemId) {
		this.itemId = itemId;
		changeDBStatus();
	}

    public Integer getResourceNum() {
	    return resourceNum;
	}
	
	public void setResourceNum(Integer resourceNum) {
		this.resourceNum = resourceNum;
		changeDBStatus();
	}
 
 	public static Resource getInstance() {
		if (instance == null)
			instance = new Resource();
		return instance;
	}
 
    @Override
    public String getSelectByKeyString(){
    	String sql="SELECT * FROM Resource WHERE 1=1  AND itemId=?   AND userId=? ";
        return sql;
    }
    
    @Override
    public String getUpdateByKeyString(){
    	String sql="UPDATE  Resource SET     resourceNum=?    WHERE 1=1   AND itemId=?  AND userId=?";
        return sql;
    }
    
    @Override
    public String getSelectAllObjectsString(){
    	String sql="SELECT * FROM Resource ";
        return sql;
    }
    
    @Override
    public String getDelObjectKeyString(){
    	String sql="DELETE  FROM Resource WHERE 1=1   AND itemId=?  AND userId=?";
        return sql;
    }
    
    @Override
    public String getSelectAllObjectsKeyString(){
    	String sql="SELECT * FROM Resource WHERE 1=1   AND itemId=?  AND userId=?";
        return sql;
    }
    
    
    @Override
	public String getTableName(){
	   return "Resource";
	}

}